//
//  TimeTool.m
//  Lawyer
//
//  Created by XMiOS on 16/2/22.
//  Copyright © 2016年 XMiOS. All rights reserved.
//

#import "TimeTool.h"

@implementation TimeTool
+ (NSString *)timeStampToTimeWithStamp:(NSString *)timeStamp
{
    long long int date = (long long int)[timeStamp intValue];
    
    NSDate *date1 = [NSDate dateWithTimeIntervalSince1970:date];
    NSTimeZone *zone = [NSTimeZone systemTimeZone];
    NSInteger interval = [zone secondsFromGMTForDate:date1];
    NSDate *localeDate = [date1  dateByAddingTimeInterval: interval];
    NSString *time = [[NSString stringWithFormat:@"%@", localeDate] substringWithRange:NSMakeRange(0, 19)];
    return time;
}
+ (NSString *)time1StampToTimeWithStamp:(NSString *)timeStamp
{
    
    long long int date = (long long int)[timeStamp intValue];
    NSDate *date1 = [NSDate dateWithTimeIntervalSince1970:date];
    NSTimeZone *zone = [NSTimeZone systemTimeZone];
    NSInteger interval = [zone secondsFromGMTForDate:date1];
    NSDate *localeDate = [date1  dateByAddingTimeInterval: interval];
    NSString *time = [[NSString stringWithFormat:@"%@", localeDate] substringWithRange:NSMakeRange(10, 6)];
    return time;
}
+ (NSString *)time2StampToTimeWithStamp:(NSString *)timeStamp{
    long long int date = (long long int)[timeStamp intValue];
    NSDate *date1 = [NSDate dateWithTimeIntervalSince1970:date];
    NSTimeZone *zone = [NSTimeZone systemTimeZone];
    NSInteger interval = [zone secondsFromGMTForDate:date1];
    NSDate *localeDate = [date1  dateByAddingTimeInterval: interval];
    NSString *time = [[NSString stringWithFormat:@"%@", localeDate] substringWithRange:NSMakeRange(0, 10)];
    return time;
}
@end
